package com.asset.salesforce.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.asset.salesforce.dao.CountryDaoImpl;
import com.asset.salesforce.model.Country;

@Service
@Transactional(readOnly=true)
public class CountryService {

	@Autowired
	CountryDaoImpl countryDao;
	
//	public Country findById(Integer id) {
//		Country country =  countryDao.;
//		return country;
//		
//	}
	
	public List<Country> getAll(){
		List<Country> countries = countryDao.listCountry();
		return  countries;
		
	}
	@Transactional(readOnly=false)
	public void add(Country country) {
		
		countryDao.addCountry(country);
	}
	@Transactional(readOnly=false)
	public void delete(Integer id) {
		countryDao.removeCountry(id);
		
		
	}
	
	public Country getCountryById(Integer id) {
		return countryDao.getCountryById(id);
		
	}
	public Country getCountryByName(String  name) {
		return countryDao.getCountryByName(name);
	}
	
//	public void edit(Country country) {
//		
//		countryDao.edit(country);
//		
//	}
//	
}
